<?php

if (isset($_GET["values"]) && isset($_GET["hourid"]))
{
	$hourid = $_GET["hourid"];
	$values = str_replace("\'", "'", $_GET["values"]);
	
	$QUERY = "
		INSERT INTO plaats (plaatsnr, lokaal, docentid, vak, maxleerlingen) 
		VALUES (NULL, $values 30)
		";
	////echo "QUERY = $QUERY <br /><br />";
	$RESULT = mysql_query($QUERY) or die('<b style="color: red; font-size: 25px;">Error!</b><br />QUERY:<br />' . $QUERY . '<br /><br />' . mysql_error());
	
	$QUERY = "
		SELECT plaatsnr
		FROM plaats
		ORDER BY plaatsnr DESC
		LIMIT 1
		";
	////echo "QUERY = $QUERY <br /><br />";
	$RESULT = mysql_query($QUERY) or die('<b style="color: red; font-size: 25px;">Error!</b><br />QUERY:<br />' . $QUERY . '<br /><br />' . mysql_error());
	
	$plaatsnr = mysql_result($RESULT, 0, "plaatsnr");
	
	$QUERY = "
		INSERT INTO studieuurplaats (plaatsnr, studieuur) 
		VALUES ($plaatsnr, $hourid)
		";
	////echo "QUERY = $QUERY <br /><br />";
	$RESULT = mysql_query($QUERY) or die('<b style="color: red; font-size: 25px;">Error!</b><br />QUERY:<br />' . $QUERY . '<br /><br />' . mysql_error());
	
}
else
{



?><table cellspacing="0" align="left" valign="top">
	<tr>
		<td colspan="<?php print($DBC->rows); ?>">
			<h1>Voeg toe: uur</h1>
		</td>
	</tr>
	<tr style="vertical-align: top;">
		<td>
			week:
		</td>
		<td>
			<select style="display: block; width: 100px;">
				<option>52</option>
				<option>53</option>
			</select>
		</td>
	</tr>
	<tr style="vertical-align: top;">
		<td>
			dag:
		</td>
		<td>
			<select style="display: block; width: 100px;">
				<option>Ma</option>
				<option>Di</option>
				<option>Wo</option>
				<option>Do</option>
				<option>Vr</option>
			</select>
		</td>
	</tr>
	<tr style="vertical-align: top;" height="100">
		<td>
			uur:
		</td>
		<td>
			<select style="display: block; width: 100px;">
				<option>0</option>
				<option>1</option>
				<option>2</option>
				<option>3</option>
				<option>4</option>
				<option>5</option>
				<option>6</option>
				<option>7</option>
				<option>8</option>
			</select>
		</td>
	</tr>
	<tr style="vertical-align: top;">
		<td colspan="2" align="center">
			<a onclick="" class="bigbutton">voeg&nbsp;toe!</a>
		</td>
	</tr>
</table>
<?php



}


?>